package com.ruoyi.wgjlcData.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.wgjlcData.domain.plat.DataWgjlcYlbh;
import com.ruoyi.wgjlcData.service.IDataWgjlcYlbhService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 无轨胶轮车压力保护Controller
 * 
 * @author ruoyi
 * @date 2024-02-27
 */
@RestController
@RequestMapping("/wgjlc/ylbh")
public class DataWgjlcYlbhController extends BaseController
{
    @Autowired
    private IDataWgjlcYlbhService dataWgjlcYlbhService;

    /**
     * 查询无轨胶轮车压力保护列表
     */
    @PreAuthorize("@ss.hasPermi('wgjlc:ylbh:list')")
    @GetMapping("/list")
    public TableDataInfo list(DataWgjlcYlbh dataWgjlcYlbh)
    {
        startPage();
        List<DataWgjlcYlbh> list = dataWgjlcYlbhService.selectDataWgjlcYlbhList(dataWgjlcYlbh);
        return getDataTable(list);
    }

    /**
     * 导出无轨胶轮车压力保护列表
     */
    @PreAuthorize("@ss.hasPermi('wgjlc:ylbh:export')")
    @Log(title = "无轨胶轮车压力保护", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DataWgjlcYlbh dataWgjlcYlbh)
    {
        List<DataWgjlcYlbh> list = dataWgjlcYlbhService.selectDataWgjlcYlbhList(dataWgjlcYlbh);
        ExcelUtil<DataWgjlcYlbh> util = new ExcelUtil<DataWgjlcYlbh>(DataWgjlcYlbh.class);
        util.exportExcel(response, list, "无轨胶轮车压力保护数据");
    }

    /**
     * 获取无轨胶轮车压力保护详细信息
     */
    @PreAuthorize("@ss.hasPermi('wgjlc:ylbh:query')")
    @GetMapping(value = "/{ylbhId}")
    public AjaxResult getInfo(@PathVariable("ylbhId") Long ylbhId)
    {
        return success(dataWgjlcYlbhService.selectDataWgjlcYlbhByYlbhId(ylbhId));
    }

    /**
     * 新增无轨胶轮车压力保护
     */
    @PreAuthorize("@ss.hasPermi('wgjlc:ylbh:add')")
    @Log(title = "无轨胶轮车压力保护", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DataWgjlcYlbh dataWgjlcYlbh)
    {
        return toAjax(dataWgjlcYlbhService.insertDataWgjlcYlbh(dataWgjlcYlbh));
    }

    /**
     * 修改无轨胶轮车压力保护
     */
    @PreAuthorize("@ss.hasPermi('wgjlc:ylbh:edit')")
    @Log(title = "无轨胶轮车压力保护", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DataWgjlcYlbh dataWgjlcYlbh)
    {
        return toAjax(dataWgjlcYlbhService.updateDataWgjlcYlbh(dataWgjlcYlbh));
    }

    /**
     * 删除无轨胶轮车压力保护
     */
    @PreAuthorize("@ss.hasPermi('wgjlc:ylbh:remove')")
    @Log(title = "无轨胶轮车压力保护", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ylbhIds}")
    public AjaxResult remove(@PathVariable Long[] ylbhIds)
    {
        return toAjax(dataWgjlcYlbhService.deleteDataWgjlcYlbhByYlbhIds(ylbhIds));
    }
}
